package UserInterface;

import javax.swing.*;
import java.awt.FlowLayout;
import java.awt.LayoutManager;
import java.awt.event.*;

class UserInterface2 {
    public static void main(String[] args) {

        ImageIcon icon = new ImageIcon("win.jpg");
        JFrame win = new JFrame("win1");
        JButton jbtn = new JButton("打开新窗口", icon);
        win.setSize(200, 200);
        win.setVisible(true);
        win.setTitle("按键功能显示");
        win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        win.setLayout(new FlowLayout());
        win.add(jbtn);
        win.validate();
        jbtn.addActionListener(
                new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        JFrame newf = new JFrame("新建窗体");
                        newf.setSize(150, 150);
                        newf.setVisible(true);

                    }
                });
    }

}